<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

</head>
<body>
<div style="font-size: 24px;margin-left: 30px;margin-top: 60px">
    我的团队：<span id="team-name"></span>
</div>
<div style="margin-left: 30px;margin-right: 30px;margin-top: 30px">
    <table class="layui-table" lay-skin="line">
        <thead>
            <tr>
                <th>
                    团队成员
                </th>
                <th>
                    邮箱
                </th>
                <th>
                    手机号
                </th>
                <th>
                    角色
                </th>
            </tr>
        </thead>
        <tbody id="tbody">

        </tbody>
    </table>
</div>
</body>
<script>
    var data = {};
    userInfo = util.getLocalStorage("user");
    data.user_id =userInfo.userId;
    data.competition_id = getUrlParam("competitionId");
    util.sendPOST("/get_my_team",data,function (resp) {
        if (resp.status){
            var data = resp.data;
            console.log(data);
            teams = data.teams;
            users = data.users;
            $("#team-name").html(teams[0].teamName);
            for (var i = 0; teams.length; i++){
                var team = teams[i];
                var user = users[i];
                var role='';
                if (team.isOwner == 0){
                    role="队长";
                }else{
                    role="队员";
                }
                var content = '<tr>' +
                                    '<td>' +
                                        user.userName+
                                    '</td>'+
                                    '<td>' +
                                        user.userEmail+
                                    '</td>'+
                                    '<td>' +
                                        user.userPhone+
                                    '</td>'+
                                    '<td>' +
                                        role+
                                    '</td>'+
                            '</tr>';
                $("#tbody").append(content);
            }
        }else {
            layer.msg(response.error_desc,{icon:2});
        }
    },function (resp) {
        layer.msg("服务端错误",{icon:2});
    });
</script>
</html>